home *** CD-ROM | disk | FTP | other *** search
- Path: goanna.cs.rmit.EDU.AU!not-for-mail
- From: ok@goanna.cs.rmit.EDU.AU (Richard A. O'Keefe)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
- Subject: Re: C/C++ knocks the crap out of Ada
- Date: 15 Mar 1996 15:06:01 +1100
- Organization: Comp Sci, RMIT, Melbourne, Australia
- Message-ID: <4iaqb9$3gi@goanna.cs.rmit.EDU.AU>
- References: <00001a73+00002504@msn.com> <3146E324.5C1E@lfwc.lockheed.com> <4i98gg$8n1@solutions.solon.com> <Do9tMv.2p3@world.std.com> <4ia41k$e04@solutions.solon.com>
- NNTP-Posting-Host: goanna.cs.rmit.edu.au
- X-Newsreader: NN version 6.5.0 #0 (NOV)
-
- seebs@solutions.solon.com (Peter Seebach) writes:
- >In article <Do9tMv.2p3@world.std.com>,
- >Robert A Duff <bobduff@world.std.com> wrote:
- >>The problem
- >>with 'make' is that you have to type in the dependences by hand.
-
- >Not always; there is a program which does this, although I personally never
- >use it.
-
- For what it's worth, the tool I currently use to build the dependencies
- for C files is called a C compiler. From the SPARCompiler CC manual page:
-
- -xM Runs the ANSI preprocessor on the named C programs,
- generates makefile dependencies and sends the result to
- the standard output (see make(1) for details about
- makefiles and dependencies). ...
-
- -xM1 Same as -xM except that -xM1 does not report dependen-
- cies for /usr/include header files.
-
- From the GNU CC manual page:
-
- -M [ -MG ]
- Tell the preprocessor to output a rule suitable for
- make describing the dependencies of each object file.
- For each source file, the preprocessor outputs one
- make-rule whose target is the object file name for that
- source file and whose dependencies are all the files
- `#include'd in it. This rule may be a single line or
- may be continued with `\'-newline if it is long. The
- list of rules is printed on standard output instead of
- the preprocessed C program. ...
-
- `-MG' says to treat missing header files as generated
- files and assume they live in the same directory as the
- source file. It must be specified in addition to `-M'.
-
- -MM [ -MG ]
- Like `-M' but the output mentions only the user header
- files included with `#include file"'. System header
- files included with `#include <file>' are omitted.
-
- ...
-
- Even lcc's preprocessor supports this. Basically, your makefile has
-
- c_dependencies: $(C_SRCS)
- cc -xM1 $(C_SRCS) >$@
-
- include c_dependencies
-
- The point here is that *make* doesn't know how to analyse C, or any
- other language or mixture of languages, but it *can* be told the results
- of such an analysis.
- --
- The election is over, and Australia lost; the idjits elected _politicians_!
- Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.
-